package org.spockprices.app.ejb.mdb;

//import java.util.logging.Logger;
//
//import javax.annotation.Resource;
//import javax.ejb.ActivationConfigProperty;
//import javax.ejb.MessageDriven;
//import javax.ejb.MessageDrivenContext;
//import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
//import javax.jms.TextMessage;

//@MessageDriven(activationConfig = {
//		@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
//		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
//}, mappedName = "jms/EmailQueue")
public class SendEmailConsumer implements MessageListener {

//	private static Logger logger = Logger.getLogger(SendEmailConsumer.class.toString());
//
//	@Resource
//	private MessageDrivenContext mdc;
//
//	public SendEmailConsumer() {
//	}
//
	public void onMessage(Message message) {
//		TextMessage msg = null;
//
//		try {
//			if (message instanceof TextMessage) {
//				msg = (TextMessage) message;
//				logger.info("MESSAGE BEAN: Message received: " + msg.getText());
//			} else {
//				logger.warning("Message of wrong type: " + message.getClass().getName());
//			}
//		} catch (JMSException e) {
//			e.printStackTrace();
//			mdc.setRollbackOnly();
//		} catch (Throwable te) {
//			te.printStackTrace();
//		}
	}

}
